package com.teradata.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
    @NotNull
    private String id;
    @NotBlank
    private String name;
    @Email
    private String email;

    @Override
    public String toString() {
        String message = "User{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", email='" + email + '\'' +
                '}';

        println(message);

        return message;
    }

    public static void println(Object message) {
        System.out.printf("[Thread :%s ] : %s \n", Thread.currentThread().getName(), String.valueOf(message));
//        try {
//            Thread.sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
    }
}
